var express = require('express');
var path = require('path');
var router = express.Router();
var sqlite3 = require('sqlite3').verbose();

/* GET users listing. */
router.get('/', function(req, res, next) {  
  var db=new sqlite3.Database(path.join(__dirname, "../db/data.s3db"));
  try{
    db.serialize(function() {
      //sqlStr = "CREATE TABLE IF NOT EXISTS TBL_meta (ID varchar2(255), label varchar2(255))"
      sqlStr = "SELECT username, truename, password from user";
      db.all(sqlStr, function(err, rows) {
        console.log("11111");
      });
      console.log("22222");
      sqlStr = "SELECT username, truename, password from user";
      db.each(sqlStr, function(err, row) {
        console.log("33333");
      });
      console.log("44444");
    });
    //res.send('ok');
    res.end();
  }catch(ex){
    console.log(ex);
  }
});

module.exports = router;
